<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">

<h:body>
	<p:dialog id="modalLogin" header="Login" hideEffect="fade" resizable="false" minHeight="400" minWidth="665" widgetVar="popupLogin" modal="true" style="position: absolute" height="400" width="665" closeOnEscape="true">
		<h:form id="formLogin" rendered="#{!loginMB.usuarioLogado}">
			<p:messages autoUpdate="true" />
			<div align="center">
				<p:panel id="display" header="CONTROLE DE ACESSO" style="margin-top:10px;">

					<h:panelGroup id="login">
						<h:panelGrid columns="3" styleClass="semBorda" columnClasses="colunaEsquerda,colunaDireita">

							<p:outputLabel for="txtUsuarioLogin" value="Usuário:" />
							<p:inputText value="#{loginMB.clienteLogin.usuario}" id="txtUsuarioLogin" size="20" maxlength="20" required="true" requiredMessage="Campo Obrigatório" />
							<p:message for="txtUsuarioLogin" />

							<p:outputLabel for="txtSenhaLogin" value="Senha:" />
							<p:password value="#{loginMB.clienteLogin.senha}" id="txtSenhaLogin" size="20" maxlength="20" required="true" requiredMessage="Campo Obrigatório" />
							<p:message for="txtSenhaLogin" />

							<p:commandButton id="btEnviarLogin" value="Enviar" icon="ui-icon-key" action="#{loginMB.logar}" update="@all"/>

							<h:panelGroup>
								<p:commandButton type="reset" value="Limpar" icon="ui-icon-trash" />
							</h:panelGroup>
						</h:panelGrid>
					</h:panelGroup>
				</p:panel>
			</div>

		</h:form>
		<h:form id="formCreatelogin">
			<p:messages for="formCreatelogin" autoUpdate="true" />
			<div align="center">

				<p:panel id="display" header="CADASTRAR NOVO USUÁRIO" style="margin-top:10px;">
					<h:panelGrid columns="2" columnClasses="colunaEsquerda,colunaDireita">

						<p:outputLabel for="txtNomeLogin" value="Nome:" />
						<p:inputText id="txtNomeLogin" value="#{loginMB.clienteCreate.nome}" size="40" maxlength="40" required="true" requiredMessage="Campo Obrigatório" />

						<p:outputLabel for="txtUsuarioCad" value="Usuario:" />
						<p:inputText id="txtUsuarioCad" value="#{loginMB.clienteCreate.usuario}" size="10" maxlength="10" required="true" requiredMessage="Campo Obrigatório" />

						<p:outputLabel for="txtSenhaCad" value="Senha:" />
						<p:password id="txtSenhaCad" value="#{loginMB.clienteCreate.senha}" size="6" maxlength="6" required="true" requiredMessage="Campo Obrigatório" />

						<p:outputLabel for="txtCpfLogin" value="CPF:" />
						<p:inputText value="#{loginMB.clienteCreate.cpf}" id="txtCpfLogin" size="11" maxlength="11" required="true" requiredMessage="Campo Obrigatório">
						</p:inputText>

						<p:outputLabel for="txtEmailLogin" value="E-Mail:" />
						<p:inputText id="txtEmailLogin" value="#{loginMB.clienteCreate.email}" size="40" maxlength="40" required="true" requiredMessage="Campo Obrigatório" />

						<p:outputLabel for="txtFoneLogin" value="Fone:" />
						<p:inputText id="txtFoneLogin" value="#{loginMB.clienteCreate.fone}" size="20" maxlength="40" required="true" requiredMessage="Campo Obrigatório">
						</p:inputText>

						<p:outputLabel for="txtCelularLogin" value="Celular" />
						<p:inputText id="txtCelularLogin" value="#{loginMB.clienteCreate.celular}" size="20" maxlength="40" required="true" requiredMessage="Campo Obrigatório">
						</p:inputText>

						<p:outputLabel for="txtEstadoLogin" value="UF: " />
						<p:inputText id="txtEstadoLogin" value="#{loginMB.clienteCreate.endereco.estado.sigla}" size="2" maxlength="2" required="true" requiredMessage="Campo UF Obrigatório" />

						<p:outputLabel for="txtCidadeLogin" value="Cidade: " />
						<p:inputText id="txtCidadeLogin" value="#{loginMB.clienteCreate.endereco.cidade.descricao}" size="30" maxlength="30" required="true" requiredMessage="Campo Cidade Obrigatório" />

						<p:outputLabel for="txtLogradouroLogin" value="Logradouro:" />
						<p:inputText id="txtLogradouroLogin" value="#{loginMB.clienteCreate.endereco.logradouro}" size="40" maxlength="40" required="true" requiredMessage="Campo Logradouro Obrigatório" />

						<p:outputLabel for="txtCEPLogin" value="CEP:" />
						<p:inputText id="txtCEPLogin" value="#{loginMB.clienteCreate.endereco.cep}" size="8" maxlength="8" required="true" requiredMessage="Campo CEP Obrigatório" />

					</h:panelGrid>

				</p:panel>
				<p:commandButton value="Enviar" action="#{loginMB.criarUsuario}"/>
			</div>
		</h:form>
	</p:dialog>
</h:body>
</html>
